/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * TestGUI.java
 *
 * Created on 07.04.2011, 13:39:22
 */
package de.jrpm.rnetze.gui;

import de.jrpm.rnetze.gui.services.VisualisierungService;
import de.jrpm.rnetze.gui.services.EinstellungenService;
import de.jrpm.rnetze.gui.services.MainGuiService;
import de.jrpm.rnetze.controlling.services.EventService;
import javax.swing.UIManager;
import javax.swing.UIManager.LookAndFeelInfo;

/**
 *
 * @author blazy
 */
public class MainGui extends javax.swing.JFrame implements MainGuiService{

    private EventService es;
    private Einstellungen einstellungen;
    private Visualisierung visualisierung;

    /** Creates new form TestGUI */
    public MainGui(EventService aThis) {
        this.es = aThis;
        initComponents();

        try {
            for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (Exception e) {
            // If Nimbus is not available, you can set the GUI to another look and feel.
        }
        einstellungen = new Einstellungen(es);
        visualisierung = new Visualisierung(es);
        jTabbedPane1.addTab("Einstellungen", einstellungen);
        jTabbedPane1.addTab("Visualisierung", visualisierung);

    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTabbedPane1 = new javax.swing.JTabbedPane();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 590, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 404, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new MainGui(null).setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTabbedPane jTabbedPane1;
    // End of variables declaration//GEN-END:variables

    public EinstellungenService getEinstellungenService() {
        return einstellungen;
    }
    
    public VisualisierungService getVisualisierungService() {
        return visualisierung;
    }

    public void switchTab(int tab) {
        jTabbedPane1.setSelectedIndex(tab);
    }
}
